package exp4;
//去重排序，从键盘输入若干个数，最后降序输出不重复的数字（用Vector/LinkedList）
import java.util.*;

public class NumberSort2 {
    public static void main(String[] args) {
        LinkedList<Integer> list = new LinkedList<>();
        Scanner cin = new Scanner(System.in);
        while (cin.hasNext()) {
            int x = cin.nextInt();
            Iterator<Integer> it = list.iterator();
            boolean find = false;
            int index = 0;
            while (it.hasNext()) {
                int k = it.next();
                if (k <= x) {
                    if(k==x)find = true;
                    break;
                }
                ++index;
            }
            if (!find) {
                list.add(index, x);//O(1)
            }
        }
        System.out.println(list);
//        Collections.reverse(list);

        /*
        Vector<Integer> vector = new Vector<Integer>();
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int x = in.nextInt();
            if (vector.indexOf(x) >= 0) continue;
            vector.add(x);
        }
//        System.out.println(vector);
        Collections.sort(vector);
        for (int i = vector.size() - 1; i >= 0; i--) {
            System.out.print(vector.get(i) + " ");
        }*/
    }
}
